<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});

Route::group(['prefix' => 'v1', 'namespace' => 'v1'], function () {
    Route::resource('students', 'StudentController');
    Route::resource('banners', 'BannerController');
    Route::resource('courses', 'CourseController');
    Route::resource('classes', 'ClassesController');
    Route::resource('categories', 'CategoryController');
//    微信
    Route::get('code2Session', 'WxController@code2Session');
    Route::post('userinfo', 'WxController@userinfo');
//    录入观看记录
    Route::post('recording/{id}', 'WatchController@recording')->where('id', '\d+');
//    获取观看记录
    Route::get('history/{id}', 'WatchController@history')->where('id', '\d+');
//    播放次数+1
    Route::post('count/{id}','ClassesController@countIncrement')->where('id', '\d+');
});
